An annotation type was introduced in the JAVA 2 Standard Edition (J2SE), release 5.0. The annotation type represents a declaration type that can be inherited down through a class hierarchy. The interplay of annotations and inheritance in the JAVA language represents a potential source of complexity for application developers. For example, given that annotations are a new feature in the JAVA language, application developers will be relying on some implicit assumptions regarding how annotations compose with other features of the JAVA language. Additionally, because annotation semantics can be defined by individual specifications, a potential exists for inconsistencies in how inheritance is implemented with respect annotations within the class hierarchy.
Some preliminary approaches to managing annotation inheritance are based on false analogies. For example, one preliminary approach states that an annotation should behave like a modifier with respect to inheritance. Another preliminary approach states that management of annotation inheritance should be accomplished only through use of the @Inherited meta-annotation. Use of the preliminary approaches to managing annotation inheritance, particular the ones identified above, results in semantics that are essentially unmanageable when considering use of annotations in more advanced JAVA programs. More specifically, annotation inheritance can become quite complex in JAVA programs that use a combination of inheritance and methods that are overloaded, overridden, or hidden.